package com.fuyd.pms.entity;

import com.fuyd.pms.entity.base.BaseEntityGen;
import org.hibernate.annotations.Type;
import org.hibernate.validator.constraints.Length;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.util.Date;

/**
 * 商品
 * Created by fuyongde on 2015/12/24.
 */
@Entity
@Table(name = "pms_merchandise")
public class Merchandise extends BaseEntityGen {

    /**商品所属商户**/
    private Merchant merchant;
    /**商品名称**/
    private String name;
    /**商品品牌**/
    private String brand;
    /**商品价格**/
    private Double price;
    /**商品的生产日期**/
    private Date produceDate;

    @Type(type = "string")
    @Length(max = 128)
    @Column(nullable = false)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    @ManyToOne
    public Merchant getMerchant() {
        return merchant;
    }

    public void setMerchant(Merchant merchant) {
        this.merchant = merchant;
    }

    @Type(type = "string")
    @Length(max = 128)
    @Column(nullable = false)
    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public Date getProduceDate() {
        return produceDate;
    }

    public void setProduceDate(Date produceDate) {
        this.produceDate = produceDate;
    }
}
